#!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals

from django.db import models

# Create your models here.
class shop(models.Model):
    shopname = models.CharField(u'购物中心名',max_length=50,blank=True)
    worker = models.CharField(u'处理人员',max_length=50,blank=True)

    def __unicode__(self):
        return '%s,%s' % (self.shopname, self.worker)
    class Meta:
        unique_together = ("shopname", "worker")
        verbose_name = u"购物中心"
        verbose_name_plural = u"购物中心"

class system(models.Model):

    # shop = models.ForeignKey(shop)
    systemname = models.CharField(u'系统名',max_length=50,blank=True)
    class Meta:
        verbose_name = u"系统模板"
        verbose_name_plural = u"系统模板"
    def __unicode__(self):
        return '%s' % (self.systemname)

class error(models.Model):
    errortype = models.CharField(u'故障类型',max_length=255,blank=True)
    system =models.ForeignKey(system)
    class Meta:
        verbose_name = u"故障模板"
        verbose_name_plural = u"故障模板"
    def __unicode__(self):
        return '%s' % (self.errortype)


class record(models.Model):
    shopname = models.CharField(u'购物中心名',max_length=50)
    systemname = models.CharField(u'系统名',max_length=50)
    errortype = models.CharField(u'故障类型',max_length=255)
    worker = models.CharField(u'处理人员',max_length=50)
    flowtime = models.CharField(u'最后修改日期',max_length=50)
    class Meta:
        verbose_name = u"记录值"
        verbose_name_plural = u"记录值"
    def __unicode__(self):
        return '%s' % (self.flowtime)


class config(models.Model):
    type = models.CharField(u'类别',max_length=50)
    comment= models.CharField(u'故障描述',max_length=255,blank=True)
    class Meta:
        verbose_name = u"配置项目"
        verbose_name_plural = u"配置项目"
    def __unicode__(self):
        return '%s    %s' % (self.type,self.comment)

class workrecord(models.Model):
    type = models.CharField(u'类别',max_length=50)
    comment = models.CharField(u'故障描述',max_length=255)
    mark = models.CharField(u'备注',max_length=255)
    time = models.CharField(u'处理时间',max_length=255)
    worker = models.CharField(u'处理人员',max_length=50)
    class Meta:
        verbose_name = u"记录值"
        verbose_name_plural = u"记录值"
    def __unicode__(self):
        return '%s    %s' % (self.type,self.comment)
